package cn.imnaer.service.rest.view.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import cn.imnaer.service.persistence.model.FriendRequest;
import cn.imnaer.service.persistence.model.TemporarySession;

/**
 * Created by Administrator on 2015/5/27.
 */
public class FriendRequestResponse implements Serializable{

    private String friendRequestId;
    private String sendUserId;
    private String sendUserName;
    private String acceptUserId;
    private String acceptUserName;
    /**
     * @see cn.imnaer.service.rpc.enums.EnumFriendRequestStatus
     */
    private String status;

    private List<TemporarySession> session = new ArrayList<>();

    public String getFriendRequestId() {
        return friendRequestId;
    }

    public void setFriendRequestId(String friendRequestId) {
        this.friendRequestId = friendRequestId;
    }

    public String getSendUserId() {
        return sendUserId;
    }

    public void setSendUserId(String sendUserId) {
        this.sendUserId = sendUserId;
    }

    public String getAcceptUserId() {
        return acceptUserId;
    }

    public void setAcceptUserId(String acceptUserId) {
        this.acceptUserId = acceptUserId;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public List<TemporarySession> getSession() {
        return session;
    }

    public void setSession(List<TemporarySession> session) {
        this.session = session;
    }

    public String getSendUserName() {
        return sendUserName;
    }

    public void setSendUserName(String sendUserName) {
        this.sendUserName = sendUserName;
    }

    public String getAcceptUserName() {
        return acceptUserName;
    }

    public void setAcceptUserName(String acceptUserName) {
        this.acceptUserName = acceptUserName;
    }

    public FriendRequestResponse parse(FriendRequest request) {
        this.friendRequestId = request.getFriendRequestId();
        this.sendUserId = request.getSendUserId();
        this.sendUserName = request.getSendUserName();
        this.acceptUserId = request.getAcceptUserId();
        this.acceptUserName = request.getAcceptUserName();
        this.status = request.getStatus();
        this.session = request.getSession();
        return this;
    }

    public static List<FriendRequestResponse> parseList(List<FriendRequest> requests) {
        List<FriendRequestResponse> result = new ArrayList<>();
        for (FriendRequest request : requests) {
            FriendRequestResponse parse = new FriendRequestResponse().parse(request);
            result.add(parse);
        }
        return result;
    }



}
